package com.zt.proxy.service;

import java.io.IOException;
import java.util.List;

import javax.validation.constraints.NotNull;
import org.dom4j.DocumentException;
import org.xml.sax.SAXException;

import com.zt.proxy.dto.PomDTO;
import com.zt.proxy.dto.ResultDTO;
import com.zt.proxy.model.PomModel;


public interface PomService {


    /**
     * parse pom, download jar, push message to redis.
     *
     * @param dto
     * @return
     */
    ResultDTO<PomDTO> invoke(PomDTO dto) throws Exception;

    /**
     * do parse pom.
     *
     * @param xml
     * @return
     * @throws IOException
     * @throws SAXException
     */
    PomModel parsePom(@NotNull String xml) throws DocumentException;

    /**
     * do append content to the end of pom.xml.
     *
     * @param pomContent
     * @param pomPath
     * @throws Exception
     */
    void appendPom(String pomContent, @NotNull String pomPath) throws Exception;

    /**
     * list all dependency.
     *
     * @param dto
     * @return
     */
    List<PomModel> listDependencies(PomDTO dto) throws DocumentException;

    /**
     * 读取jar包
     * @param path
     */
    ResultDTO<String> loadJars(String path) throws DocumentException;

}
